<include file="App/Home/View/Public/header.html"/>
<style>
.ui-btn-inline {
	width: 87%;
	margin-top: 2em;
	background-color: rgba(255,255,255,0) !important;
	text-shadow: none;
	border: none;
	box-shadow: none;
	background-color: #ffc703 !important;
	color: #333 !important;
	text-shadow: none !important;
}
.ui-shadow-inset {
	background-color: rgba(255,255,255,0) !important;
	text-shadow: none;
	border: none;
	box-shadow: none;
	background-color: rgba(0,0,0,0.5) !important;
}
.disabled { pointer-events: none; }
</style>
<!-----------------------------主体内容 开始------------------------------>
<div data-role="main" class="ui-content"> 
  <!------logo 开始------->
  <div class="">
    <div class="logo1_w70p"> <img src="/Public/Home/images/index_logo.png" width="100%"> </div>
  </div>
  <div class="clear"></div>
  <!------logo 结束-------> 
  <!------登录表单 开始------->
  <form class="w80p" method="post" action="" onsubmit="return false">
    <div class="ui-field-contain">
      <label for="username" class="ui-hidden-accessible">{$Think.lang.__SHURUZHANGHAODIANHUAHAO__}</label>
      <input type="text" name="username" id="username"   placeholder="{$Think.lang.__SHURUZHANGHAODIANHUAHAO__}" />
    </div>
    <div class="ui-field-contain">
      <label for="password1" class="ui-hidden-accessible">{$Think.lang.__QINGSHURUNIDEMIMA__}</label>
      <input type="password" name="password1" id="password1"  placeholder="{$Think.lang.__QINGSHURUNIDEMIMA__}">
    </div>
    <div class="ui-field-contain">
      <label for="password2" class="ui-hidden-accessible">{$Think.lang.__QINGZAICISHURUMIMA__}</label>
      <input type="password" name="password2" id="password2"  placeholder="{$Think.lang.__QINGZAICISHURUMIMA__}">
    </div>
    <div class="ui-field-contain verify"  >
      <label for="verify1" class="ui-hidden-accessible">{$Think.lang.__SHOUJIYANZHENGMA__}</label>
      <input type="text" name="verify1" id="verify1"  placeholder="{$Think.lang.__SHOUJIYANZHENGMA__}">
      <button id="btnbtn" data-inline="true" >{$Think.lang.__HUOQUYANZHENGMA__}</button>
    </div>
    <input class="w100p" type="button" data-inline="true" onclick="ajaxSubmit();" value="{$Think.lang.__ZHUCE__}">
  </form>
  <!------登录表单 结束-------> 
  
</div>
<!-----------------------------主体内容 结束------------------------------> 
<script type="text/javascript">
	$('#btnbtn').click(function(){
		var phone = $("#username").val();
		if(phone == ""){
			layer.msg("{$Think.lang.__SHURUZHANGHAODIANHUAHAO__}");
			$("#username").focus();return false;
		}
		
		//倒计时120秒
		var i=120;
        var tid2;
       
		$.ajax({
			url:"{:U('Login/sendPhone')}",
			type:"POST",
			data:{'phone':phone,type:2},
			dataType:"json",
			success:function (data){
				layer.msg(data.info);
				if(data.status == 1){
					 tid2=setInterval(function(){
		
				  
						$('#btnbtn').attr("disabled",true);
						
						i--;
						$('#btnbtn').html(i+"秒后可重新发送");
						if(i<=0){
							$('#btnbtn').removeAttr("disabled").html("重新发送验证码");
							
							clearInterval(tid2);
						}
				
					},1000);
				}
			}
		})
		
	})
	function ajaxSubmit(){
		var phone = $("#username").val();
		var code = $("#verify1").val();
		var password = $("#password1").val();
		var repwd = $("#password2").val();
		if(phone == ""){
			layer.msg("{$Think.lang.__QINGSHURUZHANGHAO__}");
			$("#username").focus();return false;
		}
		
		if(password == ""){
			layer.msg("{$Think.lang.__QINGCHONGZHIMIMA__}");
			$("#password1").focus();return false;
		}
		if(repwd == ""){
			layer.msg("{$Think.lang.__QINGZAICISHURUMIMA__}");
			$("#password2").focus();return false;
		}
		if(repwd != password){
			layer.msg("{$Think.lang.__MIMASHURUBUYIZHI__}");
			$("#password2").focus();return false;
		}
		if(code.length != 4){
			layer.msg("{$Think.lang.__QINGTIANXIEZHENGQUEYANZHENGMA__}");
			$("#verify1").focus();return false;
		}
		
		$.ajax({
			url:"{:U('Otherreg/reg')}",
			type:"POST",
			data:{'phone':phone,'code':code,'password':password,'repwd':repwd},
			dataType:"JSON",
			success:function (data){
				layer.msg(data.info);
				if(data.status == 1){
					location.href = "{:U('Index/index')}";
				}
			}
		})
	}
</script> 
<include file="App/Home/View/Public/footer.html"/>